package com.gm.beans;

import com.gm.entities.InscriptionAssociation;
import com.gm.controllers.InscriptionAssociationFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.inject.Named;
import javax.inject.Inject;
import javax.enterprise.context.SessionScoped;

@Named(value = "inscriptionAssociationController")
@SessionScoped
public class InscriptionAssociationController extends AbstractController<InscriptionAssociation> implements Serializable {

    @Inject
    private InscriptionAssociationFacade ejbFacade;

    public InscriptionAssociationController() {
        super(InscriptionAssociation.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getInscriptionAssociationPK().setIdPersonne(this.getSelected().getPersonne().getIdPersonne());
        this.getSelected().getInscriptionAssociationPK().setIdAssociation(this.getSelected().getAssociation().getIdAssociation());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setInscriptionAssociationPK(new com.gm.entities.InscriptionAssociationPK());
    }
}
